<?php
// +----------------------------------------------------------------------
// | ebSIG
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.ebsig.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: liudaojian <liudaojian@ebsig.com>
// +----------------------------------------------------------------------

/**
 * Ajax接口路由
 * @author   liudaojian <liudaojian@ebsig.com>
 * @version 1.0
 */

namespace App\Http\Routes;

use Illuminate\Contracts\Routing\Registrar;

class AjaxRoutes

{

    public function map(Registrar $router)
    {

        $router->group([ 'prefix' => '/lar/api/'], function($router) {

            //“进店有礼”初始化接口
            $router->get('store/gift/init', 'Api\Activity\StoreGiftController@init');
            //“进店有礼”发放奖品
            $router->get('store/gift/send', 'Api\Activity\StoreGiftController@send');

            //集点路由
            $this->jd($router);

            //活动
            $this->activity($router);

            //会员相关路由
            $this->customer($router);

            //商品相关路由
            $this->goods($router);

            $router->get('crm/test', 'Api\TestController@test'); //团购列表初始化接口

            //团购
            $router->get('tg/init', 'Api\Tg\TgController@init'); //团购列表初始化接口
            $router->get('tg/search/list', 'Api\Tg\TgController@search');   //团购列表查询接口
            $router->get('tg/detail', 'Api\Tg\TgController@detail');   //团购详情
            $router->get('tg/participate','Api\Tg\TgController@participate');   //参团接口

            $this->bill( $router );

            //预售活动
            $router->get('promotion/pre_sale/search', 'Api\Promotion\PreSaleController@search');

            //自动匹配最近的门店
            $router->get('choose/mall/default', 'Api\Mall\MallLbsController@autoMatch');

        });

    }

    private function bill($router)
    {

        $router->get('order/pay/result', 'Api\Order\BillController@payResult');
        $router->get('order/promotion/lottery' , 'Api\Order\PromotionController@lottery');      //抽奖
        $router->get('order/promotion/red/packet' , 'Api\Order\PromotionController@redPacket');  //红包
        $router->get('order/promotion/coupon' , 'Api\Order\PromotionController@coupon');  //赠券

    }
    

    //集点
    private function jd($router) {

        $router->get('jd/list', 'Api\Activity\JdController@init');   //列表
        $router->get('jd/detail', 'Api\Activity\JdController@detail');   //详情
        $router->get('jd/give', 'Api\Activity\JdController@give');   //转增页
        $router->post('jd/give/send', 'Api\Activity\JdController@giveSend');   //转增页
        $router->get('jd/prize', 'Api\Activity\JdController@prize');   //奖品页
        $router->post('jd/prize/exchange', 'Api\Activity\JdController@packageExchange');   //奖品兑换

    }

    private function activity($router){
        //集点商品列表
        $router->get('activity/goods', 'Api\Activity\ActivityController@goods');
    }

    //会员
    private function customer( $router ) {

        $router->get('customer/recharge/init', 'Api\Customer\CustomerRechargeController@init');   //充值初始化
        $router->get('customer/recharge/online/pay', 'Api\Customer\CustomerRechargeController@onlinePay');   //在线充值
        $router->get('customer/recharge/card/init', 'Api\Customer\CustomerRechargeController@rechargeCardInit');   //充值卡页面初始化
        $router->get('offline/recharge/card', 'Api\Customer\CustomerRechargeController@searchOfflineRechargeCard'); //查询线下充值卡信息
        $router->get('customer/recharge/card/pay', 'Api\Customer\CustomerRechargeController@cardPay'); //充值卡充值

    }

    //商品
    private function goods( $router ) {

        $router->get('goods/comments/list', 'Api\Goods\CommentsController@search');

    }

}